package spms.data.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import spms.data.entity.Icon;
import spms.data.service.IconService;
import spms.util.Page;

import javax.annotation.Resource;
import java.util.List;

@Api(tags = "Icon")
@RestController
public class IconController {

    @Resource
    IconService iconService;

    @ApiOperation(value = "查询所有Icon标签")
    @GetMapping("/icon/findAll")
    public List<Icon> findIconAll() throws Exception {
        return iconService.findAll(Icon.class);
    }

    @ApiOperation(value = "分页查询Icon标签")
    @GetMapping("/icon/findPage")
    public Page<Icon> findIconPage(@RequestParam Integer pageNum, @RequestParam Integer pageSize) throws Exception {
        return iconService.findPage(pageNum, pageSize, Icon.class);
    }

    @ApiOperation(value = "添加Icon标签")
    @PostMapping("/icon/addIcon")
    public boolean addIcon(@RequestBody Icon icon) {
        return iconService.addIcon(icon);
    }
}
